package com.kfm.springmybatis.config;

import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

// 1. 继承WebMvcConfigurationSupport类
@Component
public class ResourceConfig extends WebMvcConfigurationSupport {


    /**
     * 重写addResourceHandlers 静态资源映射处理
     * addResourceHandler() 你要处理的请求
     * @param registry
     */
    @Override
    protected void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/Css/**").addResourceLocations("classpath:/static/Css/");
        registry.addResourceHandler("/JS/**").addResourceLocations("classpath:/static/JS/");
        registry.addResourceHandler("/image/**").addResourceLocations("classpath:/static/image/");
        registry.addResourceHandler("/avatar/**").addResourceLocations("file:E:/upload/avatar/");
    }
}
